package com.jiadakeji.ppm.api.v1;

import com.jiadakeji.ppm.api.common.JsonResult;
import com.jiadakeji.ppm.common.web.BaseController;
import com.jiadakeji.ppm.modules.business.entity.Community;
import com.jiadakeji.ppm.modules.business.service.CommunityService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@RestController("v1_communityController")
@RequestMapping(value = "${apiPath}/v1/Community")
public class CommunityController extends BaseController {
    @Autowired
    private CommunityService communityService;




    @RequestMapping(value = "/list")
    @ApiOperation(value = "获取小区列表",httpMethod = "POST",consumes="application/json",notes="根据id")
    public JsonResult<List<Community>> list(@RequestBody Community community, HttpServletRequest request, HttpServletResponse response){
        JsonResult<List<Community>> result = new JsonResult<>();

        List<Community> communityList = communityService.findList(community);
        result.setData(communityList);
        return result;
    }


}
